package com.synergy.stockflow.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

/**
    * 权限表
    */
@Schema(description="权限表")
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "sys_permission")
public class SysPermission implements Serializable {
    /**
     * 权限编号
     */
    @TableId(value = "id", type = IdType.INPUT)
    @Schema(description="权限编号")
    private Long id;

    /**
     * 权限路由名称
     */
    @TableField(value = "`name`")
    @Schema(description="权限路由名称")
    private String name;

    /**
     * 权限路由路径
     */
    @TableField(value = "`path`")
    @Schema(description="权限路由路径")
    private String path;

    /**
     * 权限路由组件
     */
    @TableField(value = "component")
    @Schema(description="权限路由组件")
    private String component;

    /**
     * 权限图标
     */
    @TableField(value = "icon")
    @Schema(description="权限图标")
    private String icon;

    /**
     * 权限标题
     */
    @TableField(value = "title")
    @Schema(description="权限标题")
    private String title;

    /**
     * API地址
     */
    @TableField(value = "api_path")
    @Schema(description="API地址")
    private String apiPath;

    /**
     * 权限标识
     */
    @TableField(value = "perms")
    @Schema(description="权限标识")
    private String perms;

    /**
     * 权限类型 (M:菜单, P:按钮等)
     */
    @TableField(value = "`type`")
    @Schema(description="权限类型 (M:菜单, P:按钮等)")
    private String type;

    /**
     * 父级权限
     */
    @TableField(value = "parent_id")
    @Schema(description="父级权限")
    private Long parentId;

    /**
     * 父级权限
     */
    @TableField(value = "parent_name")
    @Schema(description="父级权限名称")
    private String parentName;

    /**
     * 排序
     */
    @TableField(value = "sort")
    @Schema(description="排序")
    private Integer sort;

    /**
     * 状态
     */
    @TableField(value = "`status`")
    @Schema(description="状态")
    private Byte status;

    @TableField(value = "`hidden`")
    @Schema(description = "是否隐藏")
    private Byte hidden;
    /**
     * 创建人
     */
    @TableField(value = "create_by")
    @Schema(description="创建人")
    private Long createBy;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    @Schema(description="创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /**
     * 更新者
     */
    @TableField(value = "update_by")
    @Schema(description="更新者")
    private Long updateBy;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    @Schema(description="更新时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @TableField(exist = false)
    @Schema(description = "子权限列表")
    private List<SysPermission> children;
}